<?php
Optimiser::addJavascriptFile("fancybox/jquery.fancybox-1.3.4.js");
Optimiser::addCssFile("fancybox/jquery.fancybox.css", false);
Optimiser::addCssFile("css/gallery.css");
Optimiser::addJavascriptCode("
    $(document).ready(function() {
	$('.gallery-container .gallery-thumbnail a').fancybox();
    });
");
//Optimiser::addCssCode("span#fancybox-left-ico {left: 20px !important; }");
//Optimiser::addCssCode("span#fancybox-right-ico {right: 20px !important; } ");
?>
<h2><?php echo($category['PhotoCategory']['title']); ?> - Galeria zdjęć</h2>
<a href="/gallery">Powrót do listy kategorii</a>
<div class="gallery-photos gallery-container">
    <?php
    foreach ($category['Photo'] as $photo) {
        echo("<div class=\"gallery-thumbnail\"><a rel=\"gallery\" href=\"/" . Configure::read("Gallery.photos_dir") . "/" . $photo['id'] . ".jpg\" title=\"".$category['PhotoCategory']['title']."\">");
        echo(" <img class=\"gallery-photo\" src=\"");

        if (file_exists(Configure::read("Gallery.photos_dir") . "/" . $photo['id'] . "_small.jpg"))
            echo("/" . Configure::read("Gallery.photos_dir") . "/" . $photo['id'] . "_small.jpg");
        else
            echo("/gallery/generate_thumbnail/" . $photo['id']);
        echo("\" />");
        echo("</a></div>");
    }
    ?>
</div>